﻿<navigation:Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
             xmlns:vm="clr-namespace:MVVMBasic.ViewModel"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:infs="clr-namespace:Infrastructure.Controls;assembly=Infrastructure" xmlns:tool="clr-namespace:Infrastructure.Tools.Converters;assembly=Infrastructure" xmlns:Resources="clr-namespace:Infrastructure.Assets.Resources;assembly=Infrastructure" x:Class="MVVMBasic.View.CustomerListView"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> 
    <navigation:Page.Resources>
		<DataTemplate x:Key="BirthDateColumnTemplate">
			<Grid ShowGridLines="True">
				<sdk:DatePicker Margin="8,8,0,0" d:LayoutOverrides="Width, Height" SelectedDate="{Binding BirthDate}" IsEnabled="False"/>
			</Grid>
		</DataTemplate>
        <tool:BoolToVisibilityConverter x:Key="converter" />
    </navigation:Page.Resources>

    <navigation:Page.DataContext>
        <vm:CustomerListViewViewModel />
    </navigation:Page.DataContext>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <infs:BusyIndicator x:Name="busyIndicator"
                            BusyContent="{Binding Path=ApplicationStrings.BusyIndicatorLoading, Source={StaticResource ResourceWrapper}}"
                            IsBusy="{Binding IsBusy}">
        	<Grid>
        		<Grid.RowDefinitions>
    				<RowDefinition Height="0.907*"/>
    				<RowDefinition Height="0.093*"/>
    			</Grid.RowDefinitions>     	
				
                <sdk:DataGrid x:Name="dataGrid"
                              ItemsSource="{Binding Dictionaries}"
                              AutoGenerateColumns="True">
                    <!--<sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Binding="{Binding Id}"
                                            Header="Id"
                                            IsReadOnly="True" />
                    <sdk:DataGridTextColumn Binding="{Binding FirstName}"
                                            IsReadOnly="True"
                                            Header="First Name" />
                    <sdk:DataGridTextColumn Binding="{Binding LastName}"
                                            Header="Last Name"
                                            IsReadOnly="True" />
                    <sdk:DataGridTextColumn Binding="{Binding Age}"
                                            Header="Age"
                                            IsReadOnly="True" />
                    <sdk:DataGridTemplateColumn CellTemplate="{StaticResource BirthDateColumnTemplate}"
                                                Header="Date of Birth"
                                                IsReadOnly="True" />
                </sdk:DataGrid.Columns>-->
                </sdk:DataGrid>

                <StackPanel Grid.Row="1"
                            Orientation="Horizontal">
                    <Button Content="Add"
                            HorizontalAlignment="Left"
                            Width="75"
                            Margin="5,2"
                            Command="{Binding AddCommand, Mode=OneWay}"
                            CommandParameter="{Binding SelectedItem, ElementName=dataGrid}" />
                    <Button Content="Edit"
                            Width="75"
                            Margin="5,2"
                            Command="{Binding EditCommand, Mode=OneWay}"
                            CommandParameter="{Binding SelectedItem, ElementName=dataGrid}" />
                    <Button Content="Delete"
                            Width="75"
                            Margin="5,2"
                            Command="{Binding DeleteCommand, Mode=OneWay}"
                            CommandParameter="{Binding SelectedItem, ElementName=dataGrid}" />
                    <Button Content="Login"
                            x:Name="btnLogin"
                            Width="75"
                            Margin="5,2" Click="BtnLoginClick"/>
                    <Button Content="Logout"
                            x:Name="btnLogout"
                            Width="75"
                            IsEnabled="False"
                            Margin="5,2"
                            Click="BtnLogoutClick" />
                    <Button Content="Group"
                            Width="75"
                            Margin="5,2"
                            Command="{Binding GroupCommand, Mode=OneWay}" />
                    <Button Content="Ungroup"
                            Width="75"
                            Margin="5,2"
                            Command="{Binding UngroupCommand, Mode=OneWay}" />
                    <Button Content="Sort by Description"
                            Width="75"
                            Margin="5,2"
                            Command="{Binding SortCommand, Mode=OneWay}"/>
                </StackPanel>
			</Grid>
        </infs:BusyIndicator>
    </Grid>
</navigation:Page>
